package com.shopreg.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

@Entity
@Table(name="SHOP_ADDRESS")
public class Address {

	private int addressId;
	private String addrLine1;
	private String addrLine2;
	private String addrLine3;
	private String addrLine4;
	private ShopDetails shopDetails;
	
	@Id
	@GeneratedValue(generator="gen")
	@Column(name = "ADDRESS_ID")
	@GenericGenerator(name="gen", strategy="foreign", parameters=@Parameter(name="property", value="shopDetails"))
	public int getAddressId() {
		return addressId;
	}
	public void setAddressId(int addressId) {
		this.addressId = addressId;
	}
	@Column(name = "ADDRESS_LINE_1")
	public String getAddrLine1() {
		return addrLine1;
	}
	public void setAddrLine1(String addrLine1) {
		this.addrLine1 = addrLine1;
	}
	@Column(name = "ADDRESS_LINE_2")
	public String getAddrLine2() {
		return addrLine2;
	}
	public void setAddrLine2(String addrLine2) {
		this.addrLine2 = addrLine2;
	}
	@Column(name = "ADDRESS_LINE_3")
	public String getAddrLine3() {
		return addrLine3;
	}
	public void setAddrLine3(String addrLine3) {
		this.addrLine3 = addrLine3;
	}
	@Column(name = "ADDRESS_LINE_4")
	public String getAddrLine4() {
		return addrLine4;
	}
	public void setAddrLine4(String addrLine4) {
		this.addrLine4 = addrLine4;
	}
	@OneToOne(fetch=FetchType.EAGER)
	@PrimaryKeyJoinColumn
	public ShopDetails getShopDetails() {
		return shopDetails;
	}
	public void setShopDetails(ShopDetails shopDetails) {
		this.shopDetails = shopDetails;
	}
	
	
	
}
